package com.njuse.seecjvm.instructions.comparison;

import com.njuse.seecjvm.instructions.base.NoOperandsInstruction;
import com.njuse.seecjvm.runtime.StackFrame;

public class DCMPG extends NoOperandsInstruction {

    /**
     * TODO：实现这条指令
     */
    @Override
    public void execute(StackFrame frame) {
      double v2=frame.getOperandStack().popDouble();
      double v1=frame.getOperandStack().popDouble();
      if (v1>v2) frame.getOperandStack().pushInt(1);
      if (v1==v2) frame.getOperandStack().pushInt(0);
      if (v1<v2) frame.getOperandStack().pushInt(-1);
    }
}
